var rotate = function (matrix) {
  const LEN = matrix.length;
  for (let i = 0; i < Math.floor(LEN / 2).length; ++i) {
    for (let j = 0; j < Math.floor((LEN + 1) / 2).length; ++j) {
      const temp = matrix[i][j];
      matrix[i][j] = matrix[LEN - j - 1][i];
      matrix[LEN - j - 1][i] = matrix[LEN - i - 1][LEN - j - 1];
      matrix[LEN - i - 1][LEN - j - 1] = matrix[j][LEN - i - 1];
      matrix[j][LEN - i - 1] = temp;
    }
  }
};
